home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
Sherlock 2.0
/
DevLibSrc
/
Main_DevLib
/
LIBio.h
< prev
next >
Wrap
Text File
|
1994-07-11
|
3KB
|
94 lines
/*
devlib: header file for LIBio.c.
source: LIBio.h
started: December 13, 1993.
version:
July 11, 1994.
Added io_remove, io_rename, io_seek and io_write_buffer.
May 23, 1994.
Added text_flag to io_open, io_create, io_read_all and io_read_pad_all.
January 9, 1994.
Added io_read_pad_all.
*/
#ifndef LIBio_h_
#define LIBio_h_
#pragma once
/* Constants. */
#define IO_EOF_CHAR 0x01
/* Structures and typedefs. */
#ifndef LIB_IO_TYPEDEFS
#define LIB_IO_TYPEDEFS
typedef struct io_mem_struct io_mem_block;
typedef struct io_file_struct io_file;
typedef struct io_path_list_struct io_path_list;
#endif
struct io_mem_struct {
char * mem_start; /* Logical start of buffer. */
long mem_length; /* Logical length of buffer. */
char * mem_freep; /* Use this to free the memory! */
};
struct io_file_struct {
TYPE_LIST(io_file);
int io_file_status; /* Status of file. */
char * io_file_path_name; /* File path name. */
FILE * io_file_file; /* OS file info: used only in ANSI_io.c. */
int io_file_handle; /* file handle: used only in io.c. */
char * io_file_buffer; /* File buffer. */
char * io_file_pointer; /* Pointer to first free char in buffer. */
long io_file_bufsize; /* Size of the file buffer. */
long io_file_count; /* Number of characters in the buffer. */
};
struct io_path_list_struct {
TYPE_LIST(io_path_list);
char * io_path_name;
};
/* Prototypes. */
/* Synonyms for cant_flag. */
enum { CANT_MESSAGE = TRUE, NO_CANT_MESSAGE = FALSE };
/* Synonyms for text_flag. */
enum { IO_TEXT_FILE = TRUE, IO_BINARY_FILE = FALSE };
/* Synonyms for return from io_seek. */
#define IO_SEEK_OK 0
void io_close (io_file * file);
void io_close_all (void);
io_file * io_create (char * path_name, bool cant_flag, bool text_flag);
bool io_is_open (io_file * file);
long io_length (io_file * file);
io_file * io_open (char * path_name, bool cant_flag, bool text_flag);
int io_physical_newline (void);
long io_read (io_file * file, void * buffer, long n);
io_mem_block * io_read_all (char * path_name, bool cant_flag, bool text_flag);
io_mem_block * io_read_pad_all
(char * path_name, int lead_pad, char lead_char, int trail_pad, char trail_char,
bool cant_flag, bool text_flag);
void io_remove (char * path_name);
void io_rename (char * old_name, char * new_name);
int io_seek (io_file * file, long offset);
void io_show_file (io_file * file);
long io_write (io_file * file);
long io_write_buffer (io_file * file, void * buffer, long n);
/* Global statistics variables. */
extern long io_read_chars; /* Chars read by io_read and io_read_all. */
extern long io_write_chars; /* Chars written by io_write. */
extern long io_nl_count; /* Number of consecutive newlines output. */
extern long io_line_count; /* Number of chars in current output line. */
#endif /* LIBio_h_ */